<%@ page import="ecom.beans.AccountRemote"%>
<%@ page import="ecom.shell.ShellRemote"%>
<%@ page import="javax.transaction.*"%>
<%@ page import="javax.naming.Context"%>
<%@ page import="javax.naming.InitialContext"%>
<%@ page import="javax.naming.NamingException"%>

<%@ page import="java.io.*"%>
<%@ page import="javax.xml.transform.*"%>
<%@ page import="javax.xml.transform.stream.*"%>

<!-- DEBUT MENU GAUCHE -->
<div class="left_content">
    <div id="navigation">
        <% if((Boolean)session.getAttribute("admin") == true) { %>
            <jsp:include page="menu_admin.jsp" />
        <% } %>

<!-- DEBUT MENU CATEGORIE -->
<div class="module">
    <h2><span>Mon Compte</span></h2>
    <div class="modulecontent">
        <%
        AccountRemote user = (AccountRemote) session.getAttribute("user");
        String pageToInclude = user == null ? "form_authentication.jsp" : "user_menu.jsp";
        %>
        <jsp:include page="<%=pageToInclude%>">
            <jsp:param name="redirectAction" value="referer" />
        </jsp:include>
    </div>
    <div class="module_btm">&nbsp;</div>
</div>

        <!-- DEBUT MENU CATEGORIE -->
        <div class="module">
            <h2><span>Nos produits</span></h2>
            <div class="modulecontent">
                <%
        //RECUPERATION DU SHELL
        
ShellRemote shell = (ShellRemote) session.getAttribute("shell");

        if (shell == null) {
            out.println("erreur shell jsp");
        } else {
            //FORMATAGE DU XML
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(new StreamSource("C://JAVA//wkspace//ecom//ecom-war//web//XSL/category.xsl"));
            StringWriter res = new StringWriter();
            transformer.transform(
                    new StreamSource(new StringReader(shell.executeCommand("category"))),
                    new StreamResult(res));
            out.println(res);
        }
                %>
            </div>
            <div class="module_btm">&nbsp;</div>
        </div>

        <!-- DEBUT MENU MAGASINS -->
        <div class="module">
            <h2><span>Nos Magasins</span></h2>
            <div class="modulecontent">
                <%
        //RECUPERATION DU SHELL
        if (shell == null) {
            out.println("erreur shell jsp");
        } else {
            //FORMATAGE DU XML
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(new StreamSource("C://JAVA//wkspace//ecom//ecom-war//web//XSL/store.xsl"));
            StringWriter res = new StringWriter();
            transformer.transform(
                    new StreamSource(new StringReader(shell.executeCommand("store"))),
                    new StreamResult(res));
            out.println(res);
        }
                %>
            </div>
            <div class="module_btm">&nbsp;</div>
        </div>
    </div>
</div>
<!-- FIN MENU GAUCHE -->